package view
{
	import model.DataProxy;
	import model.ViewProxy;
	
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	public class FooterViewMediator extends Mediator implements IMediator
	{
		public static const NAME:String 				= "FooterViewMediator";
		
		private var footerView:FooterView;
		
		public function FooterViewMediator( viewComponent:Object = null )
		{
			super( NAME, viewComponent );
		}
		
		override public function onRegister():void
		{
			footerView = new FooterView();
			footerView.init( viewProxy.vo );
			
			footerView.x = 0;
			footerView.y = Math.round( viewProxy.vo.HEADER_HEIGHT );
			
			viewProxy.vo.footerView = footerView;
			
			viewComponent.addChild( footerView );
		}
		
		override public function listNotificationInterests():Array
		{
			return [ ApplicationFacade.INIT ];
		}
		
		override public function handleNotification( notification:INotification ):void
		{
			var name:String = notification.getName();
			var body:Object = notification.getBody();
			
			switch( name )
			{
				case ApplicationFacade.INIT:
					footerView.show();
					break;
			}
		}
		
		public function get dataProxy():DataProxy
		{
			return facade.retrieveProxy( DataProxy.NAME ) as DataProxy;
		}
		
		public function get viewProxy():ViewProxy
		{
			return facade.retrieveProxy( ViewProxy.NAME ) as ViewProxy;
		}
	}
}